/*     */ package com.lmpop.trade.website;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import com.lmpop.frame.util.RandomID;
/*     */ import com.lmpop.trade.ti_admin.Ti_admin;
/*     */ import java.util.ArrayList;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import java.util.StringTokenizer;
/*     */ 
/*     */ public class WebsiteInfo
/*     */ {
/*  16 */   RandomID randomID = null;
/*     */   QueryList queryList;
/*  18 */   ArrayList queryResult = new ArrayList();
/*     */ 
/*  20 */   public WebsiteInfo() { this.randomID = new RandomID();
/*  21 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public ArrayList getQueryResult()
/*     */   {
/*  26 */     return this.queryResult;
/*     */   }
/*     */ 
/*     */   public void setQueryResult(ArrayList queryResult) {
/*  30 */     this.queryResult = queryResult;
/*     */   }
/*     */ 
/*     */   public SysMap addWebsiteInfo(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  35 */     String result_code = "0";
/*  36 */     WebsiteDAO daoEntity = new WebsiteDAO();
/*  37 */     String web_id = this.randomID.GenTradeId();
/*  38 */     daoEntity.setWeb_id(web_id);
/*  39 */     daoEntity.setWeb_name(map.getString("web_name"));
/*  40 */     daoEntity.setKeywords(map.getString("keywords"));
/*  41 */     daoEntity.setDescription(map.getString("description"));
/*  42 */     daoEntity.setTem_path(map.getString("tem_path"));
/*  43 */     daoEntity.setSave_dir(map.getString("save_dir"));
/*  44 */     daoEntity.setDefault_page(map.getString("default_page"));
/*  45 */     daoEntity.setState_code(map.getString("state_code"));
/*  46 */     daoEntity.setUser_id(map.getString("session_user_id"));
/*  47 */     daoEntity.setFile_dir(map.getString("file_dir"));
/*     */     try {
/*  49 */       addWebsiteInfo(dbmMgr, daoEntity);
/*     */     } catch (Exception e) {
/*  51 */       e.printStackTrace();
/*  52 */       result_code = "1";
/*     */     }
/*  54 */     map.setString("result_code", result_code);
/*  55 */     return map;
/*     */   }
/*     */ 
/*     */   public void addWebsiteInfo(DbmInterf dbmMgr, WebsiteDAO daoEntity)
/*     */     throws ApplicationException
/*     */   {
/*  61 */     dbmMgr.update("insertTi_custnews", daoEntity);
/*     */   }
/*     */ 
/*     */   public SysMap updateWebsiteInfo(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  67 */     String result_code = "0";
/*  68 */     WebsiteDAO daoEntity = new WebsiteDAO();
/*  69 */     daoEntity.setWeb_id(map.getString("web_id"));
/*  70 */     daoEntity.setWeb_name(map.getString("web_name"));
/*  71 */     daoEntity.setKeywords(map.getString("keywords"));
/*  72 */     daoEntity.setDescription(map.getString("description"));
/*  73 */     daoEntity.setTem_path(map.getString("tem_path"));
/*  74 */     daoEntity.setSave_dir(map.getString("save_dir"));
/*  75 */     daoEntity.setDefault_page(map.getString("default_page"));
/*  76 */     daoEntity.setState_code(map.getString("state_code"));
/*  77 */     daoEntity.setUser_id(map.getString("session_user_id"));
/*  78 */     daoEntity.setFile_dir(map.getString("file_dir"));
/*     */     try
/*     */     {
/*  81 */       updateWebsiteInfo(dbmMgr, daoEntity);
/*     */     } catch (Exception e) {
/*  83 */       e.printStackTrace();
/*  84 */       result_code = "1";
/*     */     }
/*  86 */     map.setString("result_code", result_code);
/*  87 */     return map;
/*     */   }
/*     */ 
/*     */   public void updateWebsiteInfo(DbmInterf dbmMgr, WebsiteDAO daoEntity) throws ApplicationException {
/*  91 */     dbmMgr.update("insertTi_custnews", daoEntity);
/*     */   }
/*     */ 
/*     */   public SysMap delWebsiteInfoByPk(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  96 */     String result_code = "0";
/*  97 */     String pkid_string = map.getString("pkid");
/*     */     try {
/*  99 */       String web_idAll = map.getString("web_id");
/* 100 */       StringTokenizer web_ids = new StringTokenizer(web_idAll, "|");
/* 101 */       while (web_ids.hasMoreTokens()) {
/* 102 */         String web_id = web_ids.nextToken();
/* 103 */         delWebsiteInfoByPk(dbmMgr, web_id);
/*     */       }
/*     */     } catch (Exception e) {
/* 106 */       e.printStackTrace();
/* 107 */       result_code = "1";
/*     */     }
/* 109 */     map.setString("result_code", result_code);
/* 110 */     map.setString("attach_root_id", pkid_string);
/* 111 */     map.setString("attach_sign", "delete");
/* 112 */     return map;
/*     */   }
/*     */   public void delWebsiteInfoByPk(DbmInterf dbmMgr, String pkid) throws ApplicationException {
/* 115 */     dbmMgr.update("deleteTi_custnews", pkid);
/*     */   }
/*     */ 
/*     */   public int getWebsiteInfoTotal(Object obj)
/*     */   {
/* 120 */     Map params = (Hashtable)obj;
/* 121 */     List list = this.queryList.getList("getCountByObjTi_custnews", params);
/* 122 */     int count = 0;
/* 123 */     if ((list != null) && (list.size() > 0)) {
/* 124 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 125 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 126 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 129 */     return count;
/*     */   }
/*     */ 
/*     */   public List getWebsiteInfoAll()
/*     */   {
/* 134 */     Map params = new Hashtable();
/* 135 */     return this.queryList.getList("getListByTi_custnewsPage", params);
/*     */   }
/*     */ 
/*     */   public Hashtable getWebsiteInfoByPk(String pk) throws ApplicationException
/*     */   {
/* 140 */     Hashtable resultMap = null;
/* 141 */     List namelist = this.queryList.getList("getnewstitle", pk);
/* 142 */     if ((namelist != null) && (namelist.size() > 0)) {
/* 143 */       resultMap = (Hashtable)namelist.get(0);
/*     */     }
/* 145 */     return resultMap;
/*     */   }
/*     */ 
/*     */   public List getAllByPage(Object obj, int start, int limit)
/*     */   {
/* 151 */     Map params = (Hashtable)obj;
/* 152 */     if (start == 0)
/* 153 */       start = 0;
/*     */     else {
/* 155 */       start = (start - 1) * limit;
/*     */     }
/* 157 */     params.put("start", Integer.valueOf(start));
/* 158 */     params.put("limit", Integer.valueOf(limit));
/* 159 */     return this.queryList.getList("getListByTi_custnewsPage", params);
/*     */   }
/*     */ 
/*     */   public String getSelectWeb() {
/* 163 */     Ti_admin ti_admin = new Ti_admin();
/* 164 */     List list = this.queryList.getList("getcompanyToSelect", ti_admin);
/* 165 */     String selectItems = "";
/* 166 */     if ((list != null) && (list.size() > 0)) {
/* 167 */       for (int i = 0; i < list.size(); i++) {
/* 168 */         Hashtable map = (Hashtable)list.get(i);
/* 169 */         String goodsId = ""; String s_cust_name = "";
/* 170 */         if (map.get("cust_id") != null) {
/* 171 */           goodsId = map.get("cust_id").toString();
/*     */         }
/* 173 */         if (map.get("cust_name") != null) {
/* 174 */           s_cust_name = map.get("cust_name").toString();
/*     */         }
/* 176 */         selectItems = selectItems + "<option value='" + goodsId + "'>" + s_cust_name + "</option>";
/*     */       }
/*     */     }
/*     */ 
/* 180 */     return selectItems;
/*     */   }
/*     */ 
/*     */   public String getSelectWeb(String web_id_para) {
/* 184 */     Ti_admin ti_admin = new Ti_admin();
/* 185 */     List list = this.queryList.getList("getcompanyToSelect", ti_admin);
/* 186 */     String selectItems = "";
/* 187 */     if ((list != null) && (list.size() > 0)) {
/* 188 */       for (int i = 0; i < list.size(); i++) {
/* 189 */         Hashtable map = (Hashtable)list.get(i);
/* 190 */         String goodsId = ""; String s_cust_name = ""; String web_id = "";
/* 191 */         if (map.get("cust_id") != null) {
/* 192 */           goodsId = map.get("cust_id").toString();
/*     */         }
/* 194 */         if (map.get("cust_name") != null) {
/* 195 */           s_cust_name = map.get("cust_name").toString();
/*     */         }
/*     */ 
/* 198 */         if (map.get("web_id") != null) {
/* 199 */           web_id = map.get("web_id").toString();
/*     */         }
/*     */ 
/* 202 */         if (web_id.equals(web_id_para)) {
/* 203 */           selectItems = selectItems + "<option value='" + goodsId + "' selected>" + s_cust_name + "</option>";
/*     */         }
/* 205 */         selectItems = selectItems + "<option value='" + goodsId + "'>" + s_cust_name + "</option>";
/*     */       }
/*     */     }
/*     */ 
/* 209 */     return selectItems;
/*     */   }
/*     */ 
/*     */   public String getWebnameById(String web_id_para) {
/* 213 */     Map ti_admin = new Hashtable();
/*     */ 
/* 216 */     List userIDLIst = this.queryList.getList("getCustClassByUserID", ti_admin);
/* 217 */     String cust_class = ""; String user_id = "";
/* 218 */     if ((userIDLIst != null) && (userIDLIst.size() > 0)) {
/* 219 */       for (int i = 0; i < userIDLIst.size(); i++) {
/* 220 */         Hashtable map = (Hashtable)userIDLIst.get(i);
/* 221 */         if (map.get("user_id") != null) {
/* 222 */           user_id = map.get("user_id").toString();
/*     */         }
/*     */ 
/* 225 */         if (user_id != null) {
/* 226 */           ti_admin.put("user_id", user_id);
/*     */         }
/* 228 */         if (map.get("cust_class") != null) {
/* 229 */           cust_class = map.get("cust_class").toString();
/*     */         }
/*     */       }
/*     */     }
/*     */ 
/* 234 */     return cust_class;
/*     */   }
/*     */ 
/*     */   public String getSavedirById(String web_id_para) {
/* 238 */     Map ti_admin = new Hashtable();
/*     */ 
/* 240 */     List userIDLIst = this.queryList.getList("getCustClassByUserID", ti_admin);
/* 241 */     String cust_class = ""; String user_id = "";
/* 242 */     if ((userIDLIst != null) && (userIDLIst.size() > 0)) {
/* 243 */       for (int i = 0; i < userIDLIst.size(); i++) {
/* 244 */         Hashtable map = (Hashtable)userIDLIst.get(i);
/*     */ 
/* 246 */         if (map.get("user_id") != null) {
/* 247 */           user_id = map.get("user_id").toString();
/*     */         }
/* 249 */         if (user_id != null) {
/* 250 */           ti_admin.put("user_id", user_id);
/*     */         }
/* 252 */         if (map.get("cust_class") != null) {
/* 253 */           cust_class = map.get("cust_class").toString();
/*     */         }
/*     */       }
/*     */     }
/*     */ 
/* 258 */     return cust_class;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.website.WebsiteInfo
 * JD-Core Version:    0.6.0
 */